package xyx.springboot.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;
import xyx.springboot.model.User;

@Repository
public interface UserMapper {
    @Insert("INSERT INTO user(id,username,password,realname,phonumber) VALUES (#{id},#{username},#{password},#{realname},#{phonumber})")
    void addUser(User user);

    @Delete("DELETE FROM user WHERE id = #{id} ")
    void deleteUser(int id);

    @Update("update user set username=#{username},password=#{password},realname=#{realname},phonumber=#{phonumber} where id=#{id}")
    void updateUser(User user);

    @Select("SELECT * FROM user WHERE id = #{id}")
    User selectUser(int id);
}
